package com.tasks.enums;

import org.apache.log4j.Logger;
import com.tasks.server.ServerException;

public class Location extends Enum {
	
	static Logger logger = Logger.getLogger(Location.class);
	
	public static final Location NULL 	= new Location(-1, "", "");
	public static final Location Home 	= new Location(1, "H", "Home");
	public static final Location Out 	= new Location(2, "O", "Out and About");
	public static final Location Work 	= new Location(3, "W", "Work");

	public static final Location[] VALUES = new Location[]
	{
		NULL,
		Home,
		Out,
		Work
	};

	public Location(int v, String c, String t) {
		super(v, c, t);
	}
	
	public static Location valueOf(int value)
	{
		for (int i = 0; i < VALUES.length; i++)
		{
			if (VALUES[i].intValue() == value)
			{
				return VALUES[i];
			}
		}

		new ServerException(Location.class, "valueOf", "Enum value is undefined: " + value);
		return null;
	}

}
